add redis_conf

Brightcells 8 years ago
parent
commit
32b6dfd487
1 changed files with 7 additions and 3 deletions
  1. 7 3
      pai2/func_settings.py

+ 7 - 3
pai2/func_settings.py

@@ -3,10 +3,14 @@
3 3
 import redis
4 4
 
5 5
 
6
-def redis_connect(conf):
7
-    return redis.StrictRedis(connection_pool=redis.ConnectionPool(**{
6
+def redis_conf(conf):
7
+    return {
8 8
         'host': conf.get('HOST', 'localhost'),
9 9
         'port': conf.get('PORT', 6379),
10 10
         'password': '{}:{}'.format(conf.get('USER', ''), conf.get('PASSWORD', '')) if conf.get('USER') else '',
11 11
         'db': conf.get('db', 0),
12
-    }))
12
+    }
13
+
14
+
15
+def redis_connect(conf):
16
+    return redis.StrictRedis(connection_pool=redis.ConnectionPool(**redis_conf(conf)))